home *** CD-ROM | disk | FTP | other *** search
- /*
- * Copyright (C) 1994, Silicon Graphics, Inc.
- * All Rights Reserved.
- *
- * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;
- * the contents of this file may not be disclosed to third parties, copied or
- * duplicated in any form, in whole or in part, without the prior written
- * permission of Silicon Graphics, Inc.
- *
- * RESTRICTED RIGHTS LEGEND:
- * Use, duplication or disclosure by the Government is subject to restrictions
- * as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
- * and Computer Software clause at DFARS 252.227-7013, and/or in similar or
- * successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
- * rights reserved under the Copyright Laws of the United States.
- */
- /*****************************************************************************
- *
- * Defines debug functions for all OpenGL calls made by Inventor.
- *
- /*****************************************************************************/
-
- #include <GL/gl.h>
- #include <GL/glu.h>
- #include <GL/glx.h>
- #include <stdio.h>
- #include <dlfcn.h>
-
- /* Pointers to the GLU, and GL (which contains GLX) DSO's */
- static const char *gl = "/usr/lib/libGL.so";
- static void *gl_dso = NULL;
- static const char *glu = "/usr/lib/libGLU.so";
- static void *glu_dso = NULL;
-
- /* If this is true, generate stupid code for some stuff */
- static int output_code = -1;
-
- /* This will be true if a routine is called from within another */
- /* routine (if an OpenGL routine calls another OpenGL routine) */
- static int recursing = 0;
-
- typedef struct Lookup {
- int enum_value;
- char *enum_string;
- } Lookup;
-
- /*
- * Note: this list is sorted by enum value, so we could use a quick
- * binary search to look through it...
- */
- static Lookup gl_constants[] = {
- {GL_ZERO, "GL_ZERO" },
- {GL_ONE, "GL_ONE" },
- {GL_ACCUM, "GL_ACCUM"},
- {GL_LOAD, "GL_LOAD"},
- {GL_RETURN, "GL_RETURN"},
- {GL_MULT, "GL_MULT"},
- {GL_ADD, "GL_ADD"},
- {GL_NEVER, "GL_NEVER"},
- {GL_LESS, "GL_LESS"},
- {GL_EQUAL, "GL_EQUAL"},
- {GL_LEQUAL, "GL_LEQUAL"},
- {GL_GREATER, "GL_GREATER"},
- {GL_NOTEQUAL, "GL_NOTEQUAL"},
- {GL_GEQUAL, "GL_GEQUAL"},
- {GL_ALWAYS, "GL_ALWAYS"},
- {GL_SRC_COLOR, "GL_SRC_COLOR"},
- {GL_ONE_MINUS_SRC_COLOR, "GL_ONE_MINUS_SRC_COLOR"},
- {GL_SRC_ALPHA, "GL_SRC_ALPHA"},
- {GL_ONE_MINUS_SRC_ALPHA, "GL_ONE_MINUS_SRC_ALPHA"},
- {GL_DST_ALPHA, "GL_DST_ALPHA"},
- {GL_ONE_MINUS_DST_ALPHA, "GL_ONE_MINUS_DST_ALPHA"},
- {GL_DST_COLOR, "GL_DST_COLOR"},
- {GL_ONE_MINUS_DST_COLOR, "GL_ONE_MINUS_DST_COLOR"},
- {GL_SRC_ALPHA_SATURATE, "GL_SRC_ALPHA_SATURATE"},
- {GL_CLIP_PLANE0, "GL_CLIP_PLANE0"},
- {GL_CLIP_PLANE1, "GL_CLIP_PLANE1"},
- {GL_CLIP_PLANE2, "GL_CLIP_PLANE2"},
- {GL_CLIP_PLANE3, "GL_CLIP_PLANE3"},
- {GL_CLIP_PLANE4, "GL_CLIP_PLANE4"},
- {GL_CLIP_PLANE5, "GL_CLIP_PLANE5"},
- {GL_FRONT_LEFT, "GL_FRONT_LEFT"},
- {GL_FRONT_RIGHT, "GL_FRONT_RIGHT"},
- {GL_BACK_LEFT, "GL_BACK_LEFT"},
- {GL_BACK_RIGHT, "GL_BACK_RIGHT"},
- {GL_FRONT, "GL_FRONT"},
- {GL_BACK, "GL_BACK"},
- {GL_LEFT, "GL_LEFT"},
- {GL_RIGHT, "GL_RIGHT"},
- {GL_FRONT_AND_BACK, "GL_FRONT_AND_BACK"},
- {GL_AUX0, "GL_AUX0"},
- {GL_AUX1, "GL_AUX1"},
- {GL_AUX2, "GL_AUX2"},
- {GL_AUX3, "GL_AUX3"},
- {GL_INVALID_ENUM, "GL_INVALID_ENUM"},
- {GL_INVALID_VALUE, "GL_INVALID_VALUE"},
- {GL_INVALID_OPERATION, "GL_INVALID_OPERATION"},
- {GL_STACK_OVERFLOW, "GL_STACK_OVERFLOW"},
- {GL_STACK_UNDERFLOW, "GL_STACK_UNDERFLOW"},
- {GL_OUT_OF_MEMORY, "GL_OUT_OF_MEMORY"},
- {GL_2D, "GL_2D"},
- {GL_3D, "GL_3D"},
- {GL_3D_COLOR, "GL_3D_COLOR"},
- {GL_3D_COLOR_TEXTURE, "GL_3D_COLOR_TEXTURE"},
- {GL_4D_COLOR_TEXTURE, "GL_4D_COLOR_TEXTURE"},
- {GL_PASS_THROUGH_TOKEN, "GL_PASS_THROUGH_TOKEN"},
- {GL_POINT_TOKEN, "GL_POINT_TOKEN"},
- {GL_LINE_TOKEN, "GL_LINE_TOKEN"},
- {GL_POLYGON_TOKEN, "GL_POLYGON_TOKEN"},
- {GL_BITMAP_TOKEN, "GL_BITMAP_TOKEN"},
- {GL_DRAW_PIXEL_TOKEN, "GL_DRAW_PIXEL_TOKEN"},
- {GL_COPY_PIXEL_TOKEN, "GL_COPY_PIXEL_TOKEN"},
- {GL_LINE_RESET_TOKEN, "GL_LINE_RESET_TOKEN"},
- {GL_EXP, "GL_EXP"},
- {GL_EXP2, "GL_EXP2"},
- {GL_CW, "GL_CW"},
- {GL_CCW, "GL_CCW"},
- {GL_COEFF, "GL_COEFF"},
- {GL_ORDER, "GL_ORDER"},
- {GL_DOMAIN, "GL_DOMAIN"},
- {GL_CURRENT_COLOR, "GL_CURRENT_COLOR"},
- {GL_CURRENT_INDEX, "GL_CURRENT_INDEX"},
- {GL_CURRENT_NORMAL, "GL_CURRENT_NORMAL"},
- {GL_CURRENT_TEXTURE_COORDS, "GL_CURRENT_TEXTURE_COORDS"},
- {GL_CURRENT_RASTER_COLOR, "GL_CURRENT_RASTER_COLOR"},
- {GL_CURRENT_RASTER_INDEX, "GL_CURRENT_RASTER_INDEX"},
- {GL_CURRENT_RASTER_TEXTURE_COORDS, "GL_CURRENT_RASTER_TEXTURE_COORDS"},
- {GL_CURRENT_RASTER_POSITION, "GL_CURRENT_RASTER_POSITION"},
- {GL_CURRENT_RASTER_POSITION_VALID, "GL_CURRENT_RASTER_POSITION_VALID"},
- {GL_CURRENT_RASTER_DISTANCE, "GL_CURRENT_RASTER_DISTANCE"},
- {GL_POINT_SMOOTH, "GL_POINT_SMOOTH"},
- {GL_POINT_SIZE, "GL_POINT_SIZE"},
- {GL_POINT_SIZE_RANGE, "GL_POINT_SIZE_RANGE"},
- {GL_POINT_SIZE_GRANULARITY, "GL_POINT_SIZE_GRANULARITY"},
- {GL_LINE_SMOOTH, "GL_LINE_SMOOTH"},
- {GL_LINE_WIDTH, "GL_LINE_WIDTH"},
- {GL_LINE_WIDTH_RANGE, "GL_LINE_WIDTH_RANGE"},
- {GL_LINE_WIDTH_GRANULARITY, "GL_LINE_WIDTH_GRANULARITY"},
- {GL_LINE_STIPPLE, "GL_LINE_STIPPLE"},
- {GL_LINE_STIPPLE_PATTERN, "GL_LINE_STIPPLE_PATTERN"},
- {GL_LINE_STIPPLE_REPEAT, "GL_LINE_STIPPLE_REPEAT"},
- {GL_LIST_MODE, "GL_LIST_MODE"},
- {GL_MAX_LIST_NESTING, "GL_MAX_LIST_NESTING"},
- {GL_LIST_BASE, "GL_LIST_BASE"},
- {GL_LIST_INDEX, "GL_LIST_INDEX"},
- {GL_POLYGON_MODE, "GL_POLYGON_MODE"},
- {GL_POLYGON_SMOOTH, "GL_POLYGON_SMOOTH"},
- {GL_POLYGON_STIPPLE, "GL_POLYGON_STIPPLE"},
- {GL_EDGE_FLAG, "GL_EDGE_FLAG"},
- {GL_CULL_FACE, "GL_CULL_FACE"},
- {GL_CULL_FACE_MODE, "GL_CULL_FACE_MODE"},
- {GL_FRONT_FACE, "GL_FRONT_FACE"},
- {GL_LIGHTING, "GL_LIGHTING"},
- {GL_LIGHT_MODEL_LOCAL_VIEWER, "GL_LIGHT_MODEL_LOCAL_VIEWER"},
- {GL_LIGHT_MODEL_TWO_SIDE, "GL_LIGHT_MODEL_TWO_SIDE"},
- {GL_LIGHT_MODEL_AMBIENT, "GL_LIGHT_MODEL_AMBIENT"},
- {GL_SHADE_MODEL, "GL_SHADE_MODEL"},
- {GL_COLOR_MATERIAL_FACE, "GL_COLOR_MATERIAL_FACE"},
- {GL_COLOR_MATERIAL_PARAMETER, "GL_COLOR_MATERIAL_PARAMETER"},
- {GL_COLOR_MATERIAL, "GL_COLOR_MATERIAL"},
- {GL_FOG, "GL_FOG"},
- {GL_FOG_INDEX, "GL_FOG_INDEX"},
- {GL_FOG_DENSITY, "GL_FOG_DENSITY"},
- {GL_FOG_START, "GL_FOG_START"},
- {GL_FOG_END, "GL_FOG_END"},
- {GL_FOG_MODE, "GL_FOG_MODE"},
- {GL_FOG_COLOR, "GL_FOG_COLOR"},
- {GL_DEPTH_RANGE, "GL_DEPTH_RANGE"},
- {GL_DEPTH_TEST, "GL_DEPTH_TEST"},
- {GL_DEPTH_WRITEMASK, "GL_DEPTH_WRITEMASK"},
- {GL_DEPTH_CLEAR_VALUE, "GL_DEPTH_CLEAR_VALUE"},
- {GL_DEPTH_FUNC, "GL_DEPTH_FUNC"},
- {GL_ACCUM_CLEAR_VALUE, "GL_ACCUM_CLEAR_VALUE"},
- {GL_STENCIL_TEST, "GL_STENCIL_TEST"},
- {GL_STENCIL_CLEAR_VALUE, "GL_STENCIL_CLEAR_VALUE"},
- {GL_STENCIL_FUNC, "GL_STENCIL_FUNC"},
- {GL_STENCIL_VALUE_MASK, "GL_STENCIL_VALUE_MASK"},
- {GL_STENCIL_FAIL, "GL_STENCIL_FAIL"},
- {GL_STENCIL_PASS_DEPTH_FAIL, "GL_STENCIL_PASS_DEPTH_FAIL"},
- {GL_STENCIL_PASS_DEPTH_PASS, "GL_STENCIL_PASS_DEPTH_PASS"},
- {GL_STENCIL_REF, "GL_STENCIL_REF"},
- {GL_STENCIL_WRITEMASK, "GL_STENCIL_WRITEMASK"},
- {GL_MATRIX_MODE, "GL_MATRIX_MODE"},
- {GL_NORMALIZE, "GL_NORMALIZE"},
- {GL_VIEWPORT, "GL_VIEWPORT"},
- {GL_MODELVIEW_STACK_DEPTH, "GL_MODELVIEW_STACK_DEPTH"},
- {GL_PROJECTION_STACK_DEPTH, "GL_PROJECTION_STACK_DEPTH"},
- {GL_TEXTURE_STACK_DEPTH, "GL_TEXTURE_STACK_DEPTH"},
- {GL_MODELVIEW_MATRIX, "GL_MODELVIEW_MATRIX"},
- {GL_PROJECTION_MATRIX, "GL_PROJECTION_MATRIX"},
- {GL_TEXTURE_MATRIX, "GL_TEXTURE_MATRIX"},
- {GL_ATTRIB_STACK_DEPTH, "GL_ATTRIB_STACK_DEPTH"},
- {GL_ALPHA_TEST, "GL_ALPHA_TEST"},
- {GL_ALPHA_TEST_FUNC, "GL_ALPHA_TEST_FUNC"},
- {GL_ALPHA_TEST_REF, "GL_ALPHA_TEST_REF"},
- {GL_DITHER, "GL_DITHER"},
- {GL_BLEND_DST, "GL_BLEND_DST"},
- {GL_BLEND_SRC, "GL_BLEND_SRC"},
- {GL_BLEND, "GL_BLEND"},
- {GL_LOGIC_OP_MODE, "GL_LOGIC_OP_MODE"},
- {GL_LOGIC_OP, "GL_LOGIC_OP"},
- {GL_AUX_BUFFERS, "GL_AUX_BUFFERS"},
- {GL_DRAW_BUFFER, "GL_DRAW_BUFFER"},
- {GL_READ_BUFFER, "GL_READ_BUFFER"},
- {GL_SCISSOR_BOX, "GL_SCISSOR_BOX"},
- {GL_SCISSOR_TEST, "GL_SCISSOR_TEST"},
- {GL_INDEX_CLEAR_VALUE, "GL_INDEX_CLEAR_VALUE"},
- {GL_INDEX_WRITEMASK, "GL_INDEX_WRITEMASK"},
- {GL_COLOR_CLEAR_VALUE, "GL_COLOR_CLEAR_VALUE"},
- {GL_COLOR_WRITEMASK, "GL_COLOR_WRITEMASK"},
- {GL_INDEX_MODE, "GL_INDEX_MODE"},
- {GL_RGBA_MODE, "GL_RGBA_MODE"},
- {GL_DOUBLEBUFFER, "GL_DOUBLEBUFFER"},
- {GL_STEREO, "GL_STEREO"},
- {GL_RENDER_MODE, "GL_RENDER_MODE"},
- {GL_PERSPECTIVE_CORRECTION_HINT, "GL_PERSPECTIVE_CORRECTION_HINT"},
- {GL_POINT_SMOOTH_HINT, "GL_POINT_SMOOTH_HINT"},
- {GL_LINE_SMOOTH_HINT, "GL_LINE_SMOOTH_HINT"},
- {GL_POLYGON_SMOOTH_HINT, "GL_POLYGON_SMOOTH_HINT"},
- {GL_FOG_HINT, "GL_FOG_HINT"},
- {GL_TEXTURE_GEN_S, "GL_TEXTURE_GEN_S"},
- {GL_TEXTURE_GEN_T, "GL_TEXTURE_GEN_T"},
- {GL_TEXTURE_GEN_R, "GL_TEXTURE_GEN_R"},
- {GL_TEXTURE_GEN_Q, "GL_TEXTURE_GEN_Q"},
- {GL_PIXEL_MAP_I_TO_I, "GL_PIXEL_MAP_I_TO_I"},
- {GL_PIXEL_MAP_S_TO_S, "GL_PIXEL_MAP_S_TO_S"},
- {GL_PIXEL_MAP_I_TO_R, "GL_PIXEL_MAP_I_TO_R"},
- {GL_PIXEL_MAP_I_TO_G, "GL_PIXEL_MAP_I_TO_G"},
- {GL_PIXEL_MAP_I_TO_B, "GL_PIXEL_MAP_I_TO_B"},
- {GL_PIXEL_MAP_I_TO_A, "GL_PIXEL_MAP_I_TO_A"},
- {GL_PIXEL_MAP_R_TO_R, "GL_PIXEL_MAP_R_TO_R"},
- {GL_PIXEL_MAP_G_TO_G, "GL_PIXEL_MAP_G_TO_G"},
- {GL_PIXEL_MAP_B_TO_B, "GL_PIXEL_MAP_B_TO_B"},
- {GL_PIXEL_MAP_A_TO_A, "GL_PIXEL_MAP_A_TO_A"},
- {GL_PIXEL_MAP_I_TO_I_SIZE, "GL_PIXEL_MAP_I_TO_I_SIZE"},
- {GL_PIXEL_MAP_S_TO_S_SIZE, "GL_PIXEL_MAP_S_TO_S_SIZE"},
- {GL_PIXEL_MAP_I_TO_R_SIZE, "GL_PIXEL_MAP_I_TO_R_SIZE"},
- {GL_PIXEL_MAP_I_TO_G_SIZE, "GL_PIXEL_MAP_I_TO_G_SIZE"},
- {GL_PIXEL_MAP_I_TO_B_SIZE, "GL_PIXEL_MAP_I_TO_B_SIZE"},
- {GL_PIXEL_MAP_I_TO_A_SIZE, "GL_PIXEL_MAP_I_TO_A_SIZE"},
- {GL_PIXEL_MAP_R_TO_R_SIZE, "GL_PIXEL_MAP_R_TO_R_SIZE"},
- {GL_PIXEL_MAP_G_TO_G_SIZE, "GL_PIXEL_MAP_G_TO_G_SIZE"},
- {GL_PIXEL_MAP_B_TO_B_SIZE, "GL_PIXEL_MAP_B_TO_B_SIZE"},
- {GL_PIXEL_MAP_A_TO_A_SIZE, "GL_PIXEL_MAP_A_TO_A_SIZE"},
- {GL_UNPACK_SWAP_BYTES, "GL_UNPACK_SWAP_BYTES"},
- {GL_UNPACK_LSB_FIRST, "GL_UNPACK_LSB_FIRST"},
- {GL_UNPACK_ROW_LENGTH, "GL_UNPACK_ROW_LENGTH"},
- {GL_UNPACK_SKIP_ROWS, "GL_UNPACK_SKIP_ROWS"},
- {GL_UNPACK_SKIP_PIXELS, "GL_UNPACK_SKIP_PIXELS"},
- {GL_UNPACK_ALIGNMENT, "GL_UNPACK_ALIGNMENT"},
- {GL_PACK_SWAP_BYTES, "GL_PACK_SWAP_BYTES"},
- {GL_PACK_LSB_FIRST, "GL_PACK_LSB_FIRST"},
- {GL_PACK_ROW_LENGTH, "GL_PACK_ROW_LENGTH"},
- {GL_PACK_SKIP_ROWS, "GL_PACK_SKIP_ROWS"},
- {GL_PACK_SKIP_PIXELS, "GL_PACK_SKIP_PIXELS"},
- {GL_PACK_ALIGNMENT, "GL_PACK_ALIGNMENT"},
- {GL_MAP_COLOR, "GL_MAP_COLOR"},
- {GL_MAP_STENCIL, "GL_MAP_STENCIL"},
- {GL_INDEX_SHIFT, "GL_INDEX_SHIFT"},
- {GL_INDEX_OFFSET, "GL_INDEX_OFFSET"},
- {GL_RED_SCALE, "GL_RED_SCALE"},
- {GL_RED_BIAS, "GL_RED_BIAS"},
- {GL_ZOOM_X, "GL_ZOOM_X"},
- {GL_ZOOM_Y, "GL_ZOOM_Y"},
- {GL_GREEN_SCALE, "GL_GREEN_SCALE"},
- {GL_GREEN_BIAS, "GL_GREEN_BIAS"},
- {GL_BLUE_SCALE, "GL_BLUE_SCALE"},
- {GL_BLUE_BIAS, "GL_BLUE_BIAS"},
- {GL_ALPHA_SCALE, "GL_ALPHA_SCALE"},
- {GL_ALPHA_BIAS, "GL_ALPHA_BIAS"},
- {GL_DEPTH_SCALE, "GL_DEPTH_SCALE"},
- {GL_DEPTH_BIAS, "GL_DEPTH_BIAS"},
- {GL_MAX_EVAL_ORDER, "GL_MAX_EVAL_ORDER"},
- {GL_MAX_LIGHTS, "GL_MAX_LIGHTS"},
- {GL_MAX_CLIP_PLANES, "GL_MAX_CLIP_PLANES"},
- {GL_MAX_TEXTURE_SIZE, "GL_MAX_TEXTURE_SIZE"},
- {GL_MAX_PIXEL_MAP_TABLE, "GL_MAX_PIXEL_MAP_TABLE"},
- {GL_MAX_ATTRIB_STACK_DEPTH, "GL_MAX_ATTRIB_STACK_DEPTH"},
- {GL_MAX_MODELVIEW_STACK_DEPTH, "GL_MAX_MODELVIEW_STACK_DEPTH"},
- {GL_MAX_NAME_STACK_DEPTH, "GL_MAX_NAME_STACK_DEPTH"},
- {GL_MAX_PROJECTION_STACK_DEPTH, "GL_MAX_PROJECTION_STACK_DEPTH"},
- {GL_MAX_TEXTURE_STACK_DEPTH, "GL_MAX_TEXTURE_STACK_DEPTH"},
- {GL_MAX_VIEWPORT_DIMS, "GL_MAX_VIEWPORT_DIMS"},
- {GL_SUBPIXEL_BITS, "GL_SUBPIXEL_BITS"},
- {GL_INDEX_BITS, "GL_INDEX_BITS"},
- {GL_RED_BITS, "GL_RED_BITS"},
- {GL_GREEN_BITS, "GL_GREEN_BITS"},
- {GL_BLUE_BITS, "GL_BLUE_BITS"},
- {GL_ALPHA_BITS, "GL_ALPHA_BITS"},
- {GL_DEPTH_BITS, "GL_DEPTH_BITS"},
- {GL_STENCIL_BITS, "GL_STENCIL_BITS"},
- {GL_ACCUM_RED_BITS, "GL_ACCUM_RED_BITS"},
- {GL_ACCUM_GREEN_BITS, "GL_ACCUM_GREEN_BITS"},
- {GL_ACCUM_BLUE_BITS, "GL_ACCUM_BLUE_BITS"},
- {GL_ACCUM_ALPHA_BITS, "GL_ACCUM_ALPHA_BITS"},
- {GL_NAME_STACK_DEPTH, "GL_NAME_STACK_DEPTH"},
- {GL_AUTO_NORMAL, "GL_AUTO_NORMAL"},
- {GL_MAP1_COLOR_4, "GL_MAP1_COLOR_4"},
- {GL_MAP1_INDEX, "GL_MAP1_INDEX"},
- {GL_MAP1_NORMAL, "GL_MAP1_NORMAL"},
- {GL_MAP1_TEXTURE_COORD_1, "GL_MAP1_TEXTURE_COORD_1"},
- {GL_MAP1_TEXTURE_COORD_2, "GL_MAP1_TEXTURE_COORD_2"},
- {GL_MAP1_TEXTURE_COORD_3, "GL_MAP1_TEXTURE_COORD_3"},
- {GL_MAP1_TEXTURE_COORD_4, "GL_MAP1_TEXTURE_COORD_4"},
- {GL_MAP1_VERTEX_3, "GL_MAP1_VERTEX_3"},
- {GL_MAP1_VERTEX_4, "GL_MAP1_VERTEX_4"},
- {GL_MAP2_COLOR_4, "GL_MAP2_COLOR_4"},
- {GL_MAP2_INDEX, "GL_MAP2_INDEX"},
- {GL_MAP2_NORMAL, "GL_MAP2_NORMAL"},
- {GL_MAP2_TEXTURE_COORD_1, "GL_MAP2_TEXTURE_COORD_1"},
- {GL_MAP2_TEXTURE_COORD_2, "GL_MAP2_TEXTURE_COORD_2"},
- {GL_MAP2_TEXTURE_COORD_3, "GL_MAP2_TEXTURE_COORD_3"},
- {GL_MAP2_TEXTURE_COORD_4, "GL_MAP2_TEXTURE_COORD_4"},
- {GL_MAP2_VERTEX_3, "GL_MAP2_VERTEX_3"},
- {GL_MAP2_VERTEX_4, "GL_MAP2_VERTEX_4"},
- {GL_MAP1_GRID_DOMAIN, "GL_MAP1_GRID_DOMAIN"},
- {GL_MAP1_GRID_SEGMENTS, "GL_MAP1_GRID_SEGMENTS"},
- {GL_MAP2_GRID_DOMAIN, "GL_MAP2_GRID_DOMAIN"},
- {GL_MAP2_GRID_SEGMENTS, "GL_MAP2_GRID_SEGMENTS"},
- {GL_TEXTURE_1D, "GL_TEXTURE_1D"},
- {GL_TEXTURE_2D, "GL_TEXTURE_2D"},
- {GL_TEXTURE_WIDTH, "GL_TEXTURE_WIDTH"},
- {GL_TEXTURE_HEIGHT, "GL_TEXTURE_HEIGHT"},
- {GL_TEXTURE_COMPONENTS, "GL_TEXTURE_COMPONENTS"},
- {GL_TEXTURE_BORDER_COLOR, "GL_TEXTURE_BORDER_COLOR"},
- {GL_TEXTURE_BORDER, "GL_TEXTURE_BORDER"},
- {GL_DONT_CARE, "GL_DONT_CARE"},
- {GL_FASTEST, "GL_FASTEST"},
- {GL_NICEST, "GL_NICEST"},
- {GL_LIGHT0, "GL_LIGHT0"},
- {GL_LIGHT1, "GL_LIGHT1"},
- {GL_LIGHT2, "GL_LIGHT2"},
- {GL_LIGHT3, "GL_LIGHT3"},
- {GL_LIGHT4, "GL_LIGHT4"},
- {GL_LIGHT5, "GL_LIGHT5"},
- {GL_LIGHT6, "GL_LIGHT6"},
- {GL_LIGHT7, "GL_LIGHT7"},
- {GL_AMBIENT, "GL_AMBIENT"},
- {GL_DIFFUSE, "GL_DIFFUSE"},
- {GL_SPECULAR, "GL_SPECULAR"},
- {GL_POSITION, "GL_POSITION"},
- {GL_SPOT_DIRECTION, "GL_SPOT_DIRECTION"},
- {GL_SPOT_EXPONENT, "GL_SPOT_EXPONENT"},
- {GL_SPOT_CUTOFF, "GL_SPOT_CUTOFF"},
- {GL_CONSTANT_ATTENUATION, "GL_CONSTANT_ATTENUATION"},
- {GL_LINEAR_ATTENUATION, "GL_LINEAR_ATTENUATION"},
- {GL_QUADRATIC_ATTENUATION, "GL_QUADRATIC_ATTENUATION"},
- {GL_COMPILE, "GL_COMPILE"},
- {GL_COMPILE_AND_EXECUTE, "GL_COMPILE_AND_EXECUTE"},
- {GL_BYTE, "GL_BYTE"},
- {GL_UNSIGNED_BYTE, "GL_UNSIGNED_BYTE"},
- {GL_SHORT, "GL_SHORT"},
- {GL_UNSIGNED_SHORT, "GL_UNSIGNED_SHORT"},
- {GL_INT, "GL_INT"},
- {GL_UNSIGNED_INT, "GL_UNSIGNED_INT"},
- {GL_FLOAT, "GL_FLOAT"},
- {GL_2_BYTES, "GL_2_BYTES"},
- {GL_3_BYTES, "GL_3_BYTES"},
- {GL_4_BYTES, "GL_4_BYTES"},
- {GL_CLEAR, "GL_CLEAR"},
- {GL_AND, "GL_AND"},
- {GL_AND_REVERSE, "GL_AND_REVERSE"},
- {GL_COPY, "GL_COPY"},
- {GL_AND_INVERTED, "GL_AND_INVERTED"},
- {GL_NOOP, "GL_NOOP"},
- {GL_XOR, "GL_XOR"},
- {GL_OR, "GL_OR"},
- {GL_NOR, "GL_NOR"},
- {GL_EQUIV, "GL_EQUIV"},
- {GL_INVERT, "GL_INVERT"},
- {GL_OR_REVERSE, "GL_OR_REVERSE"},
- {GL_COPY_INVERTED, "GL_COPY_INVERTED"},
- {GL_OR_INVERTED, "GL_OR_INVERTED"},
- {GL_NAND, "GL_NAND"},
- {GL_SET, "GL_SET"},
- {GL_EMISSION, "GL_EMISSION"},
- {GL_SHININESS, "GL_SHININESS"},
- {GL_AMBIENT_AND_DIFFUSE, "GL_AMBIENT_AND_DIFFUSE"},
- {GL_COLOR_INDEXES, "GL_COLOR_INDEXES"},
- {GL_MODELVIEW, "GL_MODELVIEW"},
- {GL_PROJECTION, "GL_PROJECTION"},
- {GL_TEXTURE, "GL_TEXTURE"},
- {GL_COLOR, "GL_COLOR"},
- {GL_DEPTH, "GL_DEPTH"},
- {GL_STENCIL, "GL_STENCIL"},
- {GL_COLOR_INDEX, "GL_COLOR_INDEX"},
- {GL_STENCIL_INDEX, "GL_STENCIL_INDEX"},
- {GL_DEPTH_COMPONENT, "GL_DEPTH_COMPONENT"},
- {GL_RED, "GL_RED"},
- {GL_GREEN, "GL_GREEN"},
- {GL_BLUE, "GL_BLUE"},
- {GL_ALPHA, "GL_ALPHA"},
- {GL_RGB, "GL_RGB"},
- {GL_RGBA, "GL_RGBA"},
- {GL_LUMINANCE, "GL_LUMINANCE"},
- {GL_LUMINANCE_ALPHA, "GL_LUMINANCE_ALPHA"},
- {GL_BITMAP, "GL_BITMAP"},
- {GL_POINT, "GL_POINT"},
- {GL_LINE, "GL_LINE"},
- {GL_FILL, "GL_FILL"},
- {GL_RENDER, "GL_RENDER"},
- {GL_FEEDBACK, "GL_FEEDBACK"},
- {GL_SELECT, "GL_SELECT"},
- {GL_FLAT, "GL_FLAT"},
- {GL_SMOOTH, "GL_SMOOTH"},
- {GL_KEEP, "GL_KEEP"},
- {GL_REPLACE, "GL_REPLACE"},
- {GL_INCR, "GL_INCR"},
- {GL_DECR, "GL_DECR"},
- {GL_VENDOR, "GL_VENDOR"},
- {GL_RENDERER, "GL_RENDERER"},
- {GL_VERSION, "GL_VERSION"},
- {GL_EXTENSIONS, "GL_EXTENSIONS"},
- {GL_S, "GL_S"},
- {GL_T, "GL_T"},
- {GL_R, "GL_R"},
- {GL_Q, "GL_Q"},
- {GL_MODULATE, "GL_MODULATE"},
- {GL_DECAL, "GL_DECAL"},
- {GL_TEXTURE_ENV_MODE, "GL_TEXTURE_ENV_MODE"},
- {GL_TEXTURE_ENV_COLOR, "GL_TEXTURE_ENV_COLOR"},
- {GL_TEXTURE_ENV, "GL_TEXTURE_ENV"},
- {GL_EYE_LINEAR, "GL_EYE_LINEAR"},
- {GL_OBJECT_LINEAR, "GL_OBJECT_LINEAR"},
- {GL_SPHERE_MAP, "GL_SPHERE_MAP"},
- {GL_TEXTURE_GEN_MODE, "GL_TEXTURE_GEN_MODE"},
- {GL_OBJECT_PLANE, "GL_OBJECT_PLANE"},
- {GL_EYE_PLANE, "GL_EYE_PLANE"},
- {GL_NEAREST, "GL_NEAREST"},
- {GL_LINEAR, "GL_LINEAR"},
- {GL_NEAREST_MIPMAP_NEAREST, "GL_NEAREST_MIPMAP_NEAREST"},
- {GL_LINEAR_MIPMAP_NEAREST, "GL_LINEAR_MIPMAP_NEAREST"},
- {GL_NEAREST_MIPMAP_LINEAR, "GL_NEAREST_MIPMAP_LINEAR"},
- {GL_LINEAR_MIPMAP_LINEAR, "GL_LINEAR_MIPMAP_LINEAR"},
- {GL_TEXTURE_MAG_FILTER, "GL_TEXTURE_MAG_FILTER"},
- {GL_TEXTURE_MIN_FILTER, "GL_TEXTURE_MIN_FILTER"},
- {GL_TEXTURE_WRAP_S, "GL_TEXTURE_WRAP_S"},
- {GL_TEXTURE_WRAP_T, "GL_TEXTURE_WRAP_T"},
- {GL_CLAMP, "GL_CLAMP"},
- {GL_REPEAT, "GL_REPEAT"},
- {GLU_SMOOTH, "GLU_SMOOTH"},
- {GLU_FLAT, "GLU_FLAT"},
- {GLU_NONE, "GLU_NONE"},
- {GLU_POINT, "GLU_POINT"},
- {GLU_LINE, "GLU_LINE"},
- {GLU_FILL, "GLU_FILL"},
- {GLU_SILHOUETTE, "GLU_SILHOUETTE"},
- {GLU_OUTSIDE, "GLU_OUTSIDE"},
- {GLU_INSIDE, "GLU_INSIDE"},
- {GLU_BEGIN, "GLU_BEGIN"},
- {GLU_VERTEX, "GLU_VERTEX"},
- {GLU_END, "GLU_END"},
- {GLU_ERROR, "GLU_ERROR"},
- {GLU_EDGE_FLAG, "GLU_EDGE_FLAG"},
- {GLU_CW, "GLU_CW"},
- {GLU_CCW, "GLU_CCW"},
- {GLU_INTERIOR, "GLU_INTERIOR"},
- {GLU_EXTERIOR, "GLU_EXTERIOR"},
- {GLU_UNKNOWN, "GLU_UNKNOWN"},
- {GLU_TESS_ERROR1, "GLU_TESS_ERROR1"},
- {GLU_TESS_ERROR2, "GLU_TESS_ERROR2"},
- {GLU_TESS_ERROR3, "GLU_TESS_ERROR3"},
- {GLU_TESS_ERROR4, "GLU_TESS_ERROR4"},
- {GLU_TESS_ERROR5, "GLU_TESS_ERROR5"},
- {GLU_TESS_ERROR6, "GLU_TESS_ERROR6"},
- {GLU_TESS_ERROR7, "GLU_TESS_ERROR7"},
- {GLU_TESS_ERROR8, "GLU_TESS_ERROR8"},
- { -1, "Bad enum" }
- };
-
-
- static int nest = 0;
-
- static void
- gl_indent()
- {
- int i;
-
- for (i = 0; i < nest / 2; i++)
- printf("\t");
-
- if (nest & 1)
- printf(" ");
- }
-
- static void
- gl_continue()
- {
- printf(" ");
- gl_indent();
- }
-
- static void
- gl_header()
- {
- if (output_code == -1) {
- if (getenv("GLCODE") != NULL) {
- output_code = 1;
- printf(" float tVec[4];\n");
- printf(" float tMat[16];\n");
- nest = 1;
- }
- else output_code = 0;
- }
- if (!output_code)
- if (recursing)
- printf(" %d: ", recursing);
- else
- printf("OPENGL: ");
- else
- if (recursing)
- printf("/* %d */ ", recursing);
- gl_indent();
- }
-
- /* Lookup enum, return a string for its name */
- static const char *
- gl_lookup_enum(Lookup *table, GLenum op)
- {
- int i;
-
- /* Dumb, linear search for now: */
- for (i = 0; table[i].enum_value != op &&
- table[i].enum_value != -1; i++) {
- /* do nothing-- keep on looping until found. */
- }
-
- if (table[i].enum_value == -1) {
- fprintf(stderr, "Error: bad gl enum value %d\n", op);
- }
- return table[i].enum_string;
- }
- /* Common case routine: */
- static const char *
- gl_enum(GLenum op)
- {
- gl_lookup_enum(gl_constants, op);
- }
-
- /* Define a vector-- used if we are outputting code */
- static void
- gl_defVec(const float *params, int nParams)
- {
- if (output_code) {
- int i;
- for (i = 0; i < nParams; i++) {
- printf("tVec[%d]=%g;", i, params[i]);
- }
- printf("\n");
- gl_indent();
- }
- }
- /* Return a string representing a vector */
- static const char *
- gl_printVec(const float *params, int nParams)
- {
- static char buf[100];
-
- if (output_code) {
- sprintf(buf, "tVec");
- }
- else {
- int i;
- char tbuf[20];
- sprintf(buf, "[ ");
- for (i = 0; i < nParams; i++) {
- if (i < nParams - 1)
- sprintf(tbuf, "%g, ", params[i]);
- else
- sprintf(tbuf, "%g", params[i]);
- strcat(buf, tbuf);
- }
- sprintf(tbuf, "]");
- strcat(buf, tbuf);
- }
- return buf;
- }
-
- /* Same as above, but these use doubles */
- static void
- gl_defVecd(const double *params, int nParams)
- {
- if (output_code) {
- int i;
- for (i = 0; i < nParams; i++) {
- printf("tVec[%d]=%lg;", i, params[i]);
- }
- printf("\n");
- gl_indent();
- }
- }
- /* Return a string representing a vector */
- static const char *
- gl_printVecd(const double *params, int nParams)
- {
- static char buf[100];
-
- if (output_code) {
- sprintf(buf, "tVec");
- }
- else {
- int i;
- char tbuf[20];
- sprintf(buf, "[ ");
- for (i = 0; i < nParams; i++) {
- if (i < nParams - 1)
- sprintf(tbuf, "%lg, ", params[i]);
- else
- sprintf(tbuf, "%lg", params[i]);
- strcat(buf, tbuf);
- }
- sprintf(tbuf, "]");
- strcat(buf, tbuf);
- }
- return buf;
- }
-
- static void
- gl_defMat(const GLfloat *m)
- {
- if (!output_code) return;
-
- printf(" tMat[0] =%6.3f;tMat[1] =%6.3f;tMat[2] =%6.3f;tMat[3] =%6.3f;\n",
- m[0], m[1], m[2], m[3]);
- gl_continue();
- printf("tMat[4] =%6.3f;tMat[5] =%6.3f;tMat[6] =%6.3f;tMat[7] =%6.3f;\n",
- m[4], m[5], m[6], m[7]);
- gl_continue();
- printf("tMat[8] =%6.3f;tMat[9] =%6.3f;tMat[10]=%6.3f;tMat[11]=%6.3f;\n",
- m[8], m[9], m[10], m[11]);
- gl_continue();
- printf("tMat[12]=%6.3f;tMat[13]=%6.3f;tMat[14]=%6.3f;tMat[15]=%6.3f;\n",
- m[12], m[13], m[14], m[15]);
- gl_indent();
- }
-
- static void
- gl_printMat(const GLfloat *m)
- {
- if (output_code) {
- printf("tMat");
- return;
- }
- printf("[%6.3f, %6.3f, %6.3f, %6.3f,\n",
- m[ 0], m[ 1], m[ 2], m[ 3]);
- gl_continue();
- printf(" %6.3f, %6.3f, %6.3f, %6.3f,\n",
- m[ 4], m[ 5], m[ 6], m[ 7]);
- gl_continue();
- printf(" %6.3f, %6.3f, %6.3f, %6.3f,\n",
- m[ 8], m[ 9], m[10], m[11]);
- gl_continue();
- printf(" %6.3f, %6.3f, %6.3f, %6.3f]",
- m[12], m[13], m[14], m[15]);
- }
-
- void *
- lookup_sym(const char *symbol, const char *dsoName, void **dso)
- {
- void *result;
-
- if (*dso == NULL) {
- *dso = dlopen(dsoName, RTLD_LAZY);
- if (*dso == NULL) {
- fprintf(stderr, "Couldn't open %s\n", dsoName);
- }
- }
- result = dlsym(*dso, symbol);
- if (result == NULL) {
- fprintf(stderr, "Couldn't find %s in %s\n", symbol, dsoName);
- }
- return result;
- }
-
- #define QUOTE(foo) # foo
-
- #define GL_GETSYM(returnType,name,argTypes) \
- static returnType (*fn) argTypes = NULL; \
- if (fn == NULL) \
- fn = (returnType (*) argTypes )lookup_sym(QUOTE(name),gl,&gl_dso)
- #define GL_CALL(name, argTypes, argVals) \
- { GL_GETSYM(void,name,argTypes); \
- ++recursing; (*fn) argVals ; --recursing; }
- #define GL_RCALL(returnType, name, argTypes, argVals) \
- { GL_GETSYM(returnType, name, argTypes); \
- ++recursing; result = (*fn) argVals ; --recursing; }
-
- void
- glAccum(GLenum op, GLfloat value)
- {
-
- gl_header();
- printf("glAccum(%s, %g);\n", gl_enum(op), value);
- GL_CALL(glAccum, (GLenum, GLfloat), (op, value));
- }
-
- void
- glBegin(GLenum mode)
- {
- static Lookup beginEnums[] = {
- {GL_POINTS, "GL_POINTS"},
- {GL_LINES, "GL_LINES"},
- {GL_LINE_LOOP, "GL_LINE_LOOP"},
- {GL_LINE_STRIP, "GL_LINE_STRIP"},
- {GL_TRIANGLES, "GL_TRIANGLES"},
- {GL_TRIANGLE_STRIP, "GL_TRIANGLE_STRIP"},
- {GL_TRIANGLE_FAN, "GL_TRIANGLE_FAN"},
- {GL_QUADS, "GL_QUADS"},
- {GL_QUAD_STRIP, "GL_QUAD_STRIP"},
- {GL_POLYGON, "GL_POLYGON"},
- {-1, "Bad begin token"},
- };
-
- gl_header();
- printf("glBegin(%s);\n", gl_lookup_enum(beginEnums, mode));
- nest++;
- GL_CALL(glBegin, (GLenum), (mode));
- }
-
- void
- glBitmap(GLsizei width, GLsizei height, GLfloat xorig,
- GLfloat yorig,GLfloat xmove, GLfloat ymove,
- const GLubyte *bitmap)
- {
- gl_header();
- printf("glBitmap(%d, %d, %g, %g, %g, %g, %#x);\n",
- width, height, xorig, yorig, xmove, ymove, bitmap);
- GL_CALL(glBitmap, \
- (GLsizei,GLsizei,GLfloat,GLfloat,GLfloat,GLfloat,const GLubyte *), \
- (width, height, xorig, yorig, xmove, ymove, bitmap));
- }
-
- void
- glBlendFunc(GLenum sfactor, GLenum dfactor)
- {
- gl_header();
- printf("glBlendFunc(%s, %s);\n", gl_enum(sfactor), gl_enum(dfactor));
- GL_CALL(glBlendFunc,(GLenum, GLenum), (sfactor, dfactor));
- }
-
- void
- glCallList(GLuint list)
- {
- gl_header();
- printf("glCallList(%d);\n", list);
- GL_CALL(glCallList,(GLuint),(list));
- }
-
- void
- glCallLists(GLsizei n, GLenum type, const GLvoid *lists)
- {
- gl_header();
- printf("glCallLists(%d, %s, \"%s\");\n", n, gl_enum(type),
- (const char *)lists);
- GL_CALL(glCallLists,(GLsizei, GLenum, const GLvoid *), \
- (n, type, lists));
- }
-
- void
- glClear(GLbitfield mask)
- {
- gl_header();
- printf("glClear(%#x);\n", mask);
- GL_CALL(glClear,(GLbitfield),(mask));
- }
-
- void
- glClearColor(GLfloat r, GLfloat g, GLfloat b, GLfloat a)
- {
- gl_header();
- printf("glClearColor(%g, %g, %g, %g);\n", r, g, b, a);
- GL_CALL(glClearColor,(GLfloat, GLfloat, GLfloat, GLfloat), (r,g,b,a));
- }
-
- void
- glClearIndex(GLfloat i)
- {
- gl_header();
- printf("glClearIndex(%g);\n", i);
- GL_CALL(glClearIndex,(GLfloat), (i));
- }
-
- void
- glClipPlane(GLenum plane, const GLdouble *equation)
- {
- gl_header();
- gl_defVecd(equation, 4);
- printf("glClipPlane(%s, %s);\n",
- gl_enum(plane), gl_printVecd(equation, 4));
- GL_CALL(glClipPlane,(GLenum, const GLdouble *), (plane, equation));
- }
-
- void
- glColor3f(GLfloat red, GLfloat green, GLfloat blue)
- {
- gl_header();
- printf("glColor3f(%g, %g, %g);\n", red, green, blue);
- GL_CALL(glColor3f,(GLfloat, GLfloat, GLfloat), (red, green, blue));
- }
-
- void
- glColor3fv(const GLfloat *v)
- {
- #ifdef VEC_ROUTINES
- gl_header();
- gl_defVec(v, 3);
- printf("glColor3fv(%s);\n", gl_printVec(v, 3));
-
- GL_CALL(glColor3fv, (const GLfloat *), (v));
- #else
- glColor3f(v[0], v[1], v[2]);
- #endif
- }
-
- void
- glColor4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
- {
- gl_header();
- printf("glColor4f(%g, %g, %g, %g);\n", red, green, blue, alpha);
- GL_CALL(glColor4f, (GLfloat,GLfloat,GLfloat,GLfloat), (red,green,blue,alpha));
- }
-
- void
- glColor4fv(const GLfloat *v)
- {
- #ifdef VEC_ROUTINES
- gl_header();
- gl_defVec(v, 4);
- printf("glColor4fv(%s);\n", gl_printVec(v, 4));
- GL_CALL(glColor4fv, (const GLfloat *), (v));
- #else
- glColor4f(v[0], v[1], v[2], v[3]);
- #endif
- }
-
- void
- glColor4ub(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha)
- {
- gl_header();
- printf("glColor4ub(%d, %d, %d, %d);\n",
- (int) red, (int) green, (int) blue, (int) alpha);
- GL_CALL(glColor4ub, (GLubyte,GLubyte,GLubyte,GLubyte), (red,green,blue,alpha));
- }
-
- void
- glColorMaterial(GLenum face, GLenum mode)
- {
- gl_header();
- printf("glColorMaterial(%s, %s);\n", gl_enum(face), gl_enum(mode));
- GL_CALL(glColorMaterial, (GLenum,GLenum), (face,mode));
- }
-
- void
- glCullFace(GLenum mode)
- {
- gl_header();
- printf("glCullFace(%s);\n", gl_enum(mode));
- GL_CALL(glCullFace, (GLenum), (mode));
- }
-
- void
- glDeleteLists(GLuint list, GLsizei range)
- {
- gl_header();
- printf("glDeleteLists(%d, %d);\n", list, range);
- GL_CALL(glDeleteLists, (GLuint, GLsizei), (list,range));
- }
-
- void
- glDepthFunc(GLenum func)
- {
- gl_header();
- printf("glDepthFunc(%s);\n", gl_enum(func));
- GL_CALL(glDepthFunc, (GLenum), (func));
- }
-
- void
- glDepthMask(GLboolean flag)
- {
- gl_header();
- printf("glDepthMask(%d);\n", flag);
- GL_CALL(glDepthMask, (GLboolean), (flag));
- }
-
- void
- glDisable(GLenum cap)
- {
- gl_header();
- printf("glDisable(%s);\n", gl_enum(cap));
- GL_CALL(glDisable, (GLenum), (cap));
- }
-
- void
- glDrawBuffer(GLenum mode)
- {
- gl_header();
- printf("glDrawBuffer(%s);\n", gl_enum(mode));
- GL_CALL(glDrawBuffer, (GLenum), (mode));
- }
-
- void
- glEnable(GLenum cap)
- {
- gl_header();
- printf("glEnable(%s);\n", gl_enum(cap));
- GL_CALL(glEnable, (GLenum), (cap));
- }
-
- void
- glEnd(void)
- {
- nest--;
- gl_header();
- printf("glEnd();\n");
- GL_CALL(glEnd, (), ());
- }
-
- void
- glEndList(void)
- {
- nest--;
- gl_header();
- printf("glEndList();\n");
- GL_CALL(glEndList, (), ());
- }
-
- void
- glFlush()
- {
- gl_header();
- printf("glFlush();\n");
- GL_CALL(glFlush, (), ());
- }
-
- void
- glFogf(GLenum pname, GLfloat param)
- {
- gl_header();
- printf("glFogf(%s, %g);\n", gl_enum(pname), param);
- GL_CALL(glFogf, (GLenum,GLfloat), (pname,param));
- }
-
- void
- glFogfv(GLenum pname, const GLfloat *params)
- {
- gl_header();
- gl_defVec(params, 3);
- printf("glFogfv(%s, %s);\n",
- gl_enum(pname), gl_printVec(params, 3));
- GL_CALL(glFogfv, (GLenum,const GLfloat *), (pname, params));
- }
-
- void
- glFrontFace(GLenum mode)
- {
- gl_header();
- printf("glFrontFace(%s);\n", gl_enum(mode));
- GL_CALL(glFrontFace, (GLenum), (mode));
- }
-
- GLuint
- glGenLists(GLsizei range)
- {
- int result;
-
- gl_header();
- printf("glGenLists(%d);\n", range);
- GL_RCALL(GLuint,glGenLists,(GLsizei),(range));
- printf(" /* glGenLists returned %d */\n", result);
- return result;
- }
-
- void
- glGetBooleanv(GLenum pname, GLboolean *params)
- {
- gl_header();
- if (output_code) printf("/* ");
- printf("glGetBooleanv(%s, ...);", gl_enum(pname));
- if (output_code) printf(" */");
- printf("\n");
- GL_CALL(glGetBooleanv, (GLenum, GLboolean *), (pname,params));
- }
-
- GLenum
- glGetError()
- {
- GLenum result;
-
- gl_header();
- printf("glGetError();\n");
- GL_RCALL(GLenum,glGetError,(),());
- printf("/* glGetError returned %d */\n", result);
- return result;
- }
-
- void
- glGetFloatv(GLenum pname, GLfloat *params)
- {
- gl_header();
- if (output_code) printf("/* ");
- printf("glGetFloatv(%s, ...);", gl_enum(pname));
- if (output_code) printf("*/");
- printf("\n");
- GL_CALL(glGetFloatv, (GLenum,GLfloat *), (pname,params));
- }
-
- void
- glGetIntegerv(GLenum pname, GLint *params)
- {
- gl_header();
- if (output_code) printf("/* ");
- printf("glGetIntegerv(%s, ...);", gl_enum(pname));
- if (output_code) printf("*/");
- printf("\n");
-
- /* Special case for values Inventor relies upon */
- if (pname == GL_MAX_LIGHTS)
- *params = 8;
- GL_CALL(glGetIntegerv, (GLenum,GLint *), (pname,params));
- }
-
- void
- glIndexi(GLint c)
- {
- gl_header();
- printf("glIndexi(%d);\n", c);
- GL_CALL(glIndexi, (GLint), (c));
- }
-
- void
- glLightModelfv(GLenum pname, const GLfloat *params)
- {
- gl_header();
- gl_defVec(params, 4);
- GL_CALL(glLightModelfv, (GLenum,const GLfloat *), (pname,params));
- printf("glLightModelfv(%s, %s);\n", gl_enum(pname),
- gl_printVec(params, 4));
- }
-
- void
- glLightModeli(GLenum pname, GLint param)
- {
- gl_header();
- printf("glLightModeli(%s, %d);\n", gl_enum(pname), param);
- GL_CALL(glLightModeli, (GLenum, GLint), (pname, param));
- }
-
- void
- glLightf(GLenum light, GLenum pname, GLfloat param)
- {
- gl_header();
- printf("glLightf(%s, %s, %g);\n", gl_enum(light), gl_enum(pname), param);
- GL_CALL(glLightf, (GLenum,GLenum,GLfloat), (light,pname,param));
- }
-
- void
- glLightfv(GLenum light, GLenum pname, const GLfloat *params)
- {
- gl_header();
- if (pname == GL_SPOT_DIRECTION) {
- gl_defVec(params, 3);
- printf("glLightfv(%s, %s, %s);\n",
- gl_enum(light), gl_enum(pname),
- gl_printVec(params, 3));
- GL_CALL(glLightfv, (GLenum,GLenum,const GLfloat *), (light,pname,params));
- }
- else {
- gl_defVec(params, 4);
- printf("glLightfv(%s, %s, %s);\n",
- gl_enum(light), gl_enum(pname),
- gl_printVec(params, 4));
- }
- }
-
- void
- glLineStipple(GLint factor, GLushort pattern)
- {
- gl_header();
- printf("glLineStipple(%d, %#hx);\n", factor, pattern);
- GL_CALL(glLineStipple, (GLint,GLushort), (factor,pattern));
- }
-
- void
- glLineWidth(GLfloat width)
- {
- gl_header();
- printf("glLineWidth(%g);\n", width);
- GL_CALL(glLineWidth, (GLfloat), (width));
- }
-
- void
- glListBase(GLuint base)
- {
- gl_header();
- printf("glListBase(%d);\n", base);
- GL_CALL(glListBase, (GLuint), (base));
- }
-
- void
- glLoadIdentity()
- {
- gl_header();
- printf("glLoadIdentity();\n");
- GL_CALL(glLoadIdentity, (), ());
- }
-
- void
- glLoadMatrixf(const GLfloat *m)
- {
- gl_header();
- gl_defMat(m);
- printf("glLoadMatrixf(");
- gl_printMat(m);
- printf(");\n");
-
- GL_CALL(glLoadMatrixf, (const GLfloat *), (m));
- }
-
- void
- glMaterialf(GLenum face, GLenum pname, GLfloat param)
- {
- gl_header();
- printf("glMaterialf(%s, %s, %g);\n", gl_enum(face), gl_enum(pname), param);
- GL_CALL(glMaterialf, (GLenum,GLenum,GLfloat), (face,pname,param));
- }
-
- void
- glMaterialfv(GLenum face, GLenum pname, const GLfloat *params)
- {
- gl_header();
-
- if (pname == GL_SHININESS)
- printf("glMaterialfv(%s, %s, [ %g ]);\n",
- gl_enum(face), gl_enum(pname), *params);
-
- else if (pname == GL_COLOR_INDEXES) {
- gl_defVec(params, 3);
- printf("glMaterialfv(%s, %s, %s);\n",
- gl_enum(face), gl_enum(pname), gl_printVec(params, 3));
- GL_CALL(glMaterialfv, (GLenum,GLenum,const GLfloat *), (face,pname,params));
- }
-
- else {
- gl_defVec(params, 4);
- printf("glMaterialfv(%s, %s, %s);\n",
- gl_enum(face), gl_enum(pname), gl_printVec(params, 4));
- }
- }
-
- void
- glMatrixMode(GLenum mode)
- {
- gl_header();
- printf("glMatrixMode(%s);\n", gl_enum(mode));
- GL_CALL(glMatrixMode, (GLenum), (mode));
- }
-
- void
- glMultMatrixf(const GLfloat *m)
- {
- gl_header();
- printf("glMultMatrixf([%6.3f, %6.3f, %6.3f, %6.3f,\n",
- m[ 0], m[ 1], m[ 2], m[ 3]);
- gl_continue();
- printf(" %6.3f, %6.3f, %6.3f, %6.3f,\n",
- m[ 4], m[ 5], m[ 6], m[ 7]);
- gl_continue();
- printf(" %6.3f, %6.3f, %6.3f, %6.3f,\n",
- m[ 8], m[ 9], m[10], m[11]);
- gl_continue();
- printf(" %6.3f, %6.3f, %6.3f, %6.3f]);\n",
- m[12], m[13], m[14], m[15]);
- GL_CALL(glMultMatrixf, (const GLfloat *), (m));
- }
-
- void
- glNewList(GLuint list, GLenum mode)
- {
- gl_header();
- printf("glNewList(%d, %s);\n", list, gl_enum(mode));
- nest++;
- GL_CALL(glNewList, (GLuint,GLenum), (list,mode));
- }
-
- void
- glNormal3f(GLfloat nx, GLfloat ny, GLfloat nz)
- {
- gl_header();
- printf("glNormal3f(%g, %g, %g);\n", nx, ny, nz);
- GL_CALL(glNormal3f, (GLfloat,GLfloat,GLfloat), (nx,ny,nz));
- }
-
- void
- glNormal3fv(const GLfloat *v)
- {
- #ifdef VEC_ROUTINES
- gl_header();
- gl_defVec(v, 3);
- printf("glNormal3fv(%s);\n", gl_printVec(v, 3));
- GL_CALL(glNormal3fv, (const GLfloat *), (v));
- #else
- glNormal3f(v[0], v[1], v[2]);
- #endif
- }
-
- void
- glOrtho(GLdouble left, GLdouble right,GLdouble bottom, GLdouble
- top,GLdouble near, GLdouble far)
- {
- gl_header();
- printf("glOrtho(%lg, %lg, %lg, %lg, %lg, %lg);\n",
- left, right, bottom, top, near, far);
- GL_CALL(glOrtho, \
- (GLdouble,GLdouble,GLdouble,GLdouble,GLdouble,GLdouble), \
- (left, right, bottom, top, near, far));
- }
-
- void
- glPixelStorei(GLenum pname, GLint param)
- {
- gl_header();
- printf("glPixelStorei(%s, %d);\n", gl_enum(pname), param);
- GL_CALL(glPixelStorei, (GLenum, GLint), (pname, param));
- }
-
- void
- glPixelTransferf(GLenum pname, GLfloat param)
- {
- gl_header();
- printf("glPixelTransferf(%s, %f);\n", gl_enum(pname), param);
- GL_CALL(glPixelTransferf, (GLenum, GLfloat), (pname,param));
- }
-
- void
- glPointSize(GLfloat size)
- {
- gl_header();
- printf("glPointSize(%g);\n", size);
- GL_CALL(glPointSize, (GLfloat), (size));
- }
-
- void
- glPolygonMode(GLenum face, GLenum mode)
- {
- gl_header();
- printf("glPolygonMode(%s, %s);\n", gl_enum(face), gl_enum(mode));
- GL_CALL(glPolygonMode, (GLenum, GLenum), (face,mode));
- }
-
- static char *
- getStipBuf(const unsigned long *l)
- {
- int i;
- static char buf[33];
-
- for (i = 0; i < 32; i++)
- buf[i] = (*l & (1 << (31 - i)) ? '#' : '.');
-
- buf[32] = '\0';
-
- return buf;
- }
-
- void
- glPolygonStipple(const GLubyte *mask)
- {
- int i;
- const unsigned long *ul;
-
- gl_header();
- ul = (const unsigned long *) mask;
- printf("glPolygonStipple(0x%.8lx, /* %s */\n", *ul, getStipBuf(ul));
-
- for (i = 1; i < 31; i++) {
- gl_continue();
- ul = (const unsigned long *) (mask + 4 * i);
- printf(" 0x%.8lx, /* %s */\n",
- *ul, getStipBuf(ul));
- }
-
- gl_continue();
- ul = (const unsigned long *) (mask + 4 * 31);
- printf(" 0x%.8lx); /* %s */\n", *ul, getStipBuf(ul));
-
- GL_CALL(glPolygonStipple, (const GLubyte *), (mask));
- }
-
- void
- glPopAttrib(void)
- {
- nest--;
- gl_header();
- printf("glPopAttrib();\n");
- GL_CALL(glPopAttrib, (), ());
- }
-
- void
- glPopMatrix(void)
- {
- nest--;
- gl_header();
- printf("glPopMatrix();\n");
- GL_CALL(glPopMatrix, (), ());
- }
-
- void
- glPushAttrib(GLbitfield mask)
- {
- gl_header();
- printf("glPushAttrib(%#x);\n", mask);
- nest++;
- GL_CALL(glPushAttrib, (GLbitfield), (mask));
- }
-
- void
- glPushMatrix(void)
- {
- gl_header();
- printf("glPushMatrix();\n");
- nest++;
- GL_CALL(glPushMatrix, (), ());
- }
-
- void
- glRasterPos3fv(const GLfloat *v)
- {
- gl_header();
- gl_defVec(v, 3);
- printf("glRasterPos3fv(%s);\n", gl_printVec(v, 3));
- GL_CALL(glRasterPos3fv, (const GLfloat *), (v));
- }
-
- void
- glReadBuffer (GLenum mode)
- {
- gl_header();
- printf("glReadBuffer(%d);\n", gl_enum(mode));
- GL_CALL(glReadBuffer, (GLenum), (mode));
- }
-
- void
- glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height,GLenum
- format, GLenum type, GLvoid *pixels)
- {
- gl_header();
- printf("glReadPixels(%d, %d, %d, %d, %s, %s, %#x);\n",
- x, y, width, height, gl_enum(format), gl_enum(type), pixels);
-
- GL_CALL(glReadPixels, \
- (GLint,GLint,GLsizei,GLsizei,GLenum,GLenum,GLvoid *), \
- (x,y,width,height,format,type,pixels));
- }
-
- void
- glRects(GLshort x1, GLshort y1, GLshort x2, GLshort y2)
- {
- gl_header();
- printf("glRects(%hd, %hd, %hd, %hd);\n", x1, y1, x2, y2);
-
- GL_CALL(glRects, (GLshort,GLshort,GLshort,GLshort), \
- (x1,y1,x2,y2));
- }
-
- void
- glRotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z)
- {
- gl_header();
- printf("glRotatef(%g, %g, %g, %g);\n", angle, x, y, z);
-
- GL_CALL(glRotatef, (GLfloat,GLfloat,GLfloat,GLfloat), \
- (angle, x, y, z));
- }
-
- void
- glScalef(GLfloat x, GLfloat y, GLfloat z)
- {
- gl_header();
- printf("glScalef(%g, %g, %g);\n", x, y, z);
- GL_CALL(glScalef, (GLfloat,GLfloat,GLfloat), (x,y,z));
- }
-
- void
- glScissor(GLint x, GLint y, GLsizei width, GLsizei height)
- {
- gl_header();
- printf("glScissor(%d, %d, %d, %d);\n", x, y, width, height);
-
- GL_CALL(glScissor, (GLint,GLint,GLsizei,GLsizei), \
- (x,y,width,height));
- }
-
- void
- glShadeModel(GLenum mode)
- {
- gl_header();
- printf("glShadeModel(%s);\n", gl_enum(mode));
- GL_CALL(glShadeModel, (GLenum), (mode));
- }
-
- void
- glTexCoord2f(GLfloat s, GLfloat t)
- {
- gl_header();
- printf("glTexCoord2f(%g, %g);\n", s, t);
- GL_CALL(glTexCoord2f, (GLfloat,GLfloat), (s,t));
- }
-
- void
- glTexCoord2fv(const GLfloat *v)
- {
- #ifdef VEC_ROUTINES
- gl_header();
- gl_defVec(v, 2);
- printf("glTexCoord2fv(%s);\n", gl_printVec(v, 2));
- GL_CALL(glTexCoord2fv, (const GLfloat *), (v));
- #else
- glTexCoord2f(v[0], v[1]);
- #endif
- }
-
- void
- glTexCoord4fv(const GLfloat *v)
- {
- gl_header();
- gl_defVec(v, 4);
- printf("glTexCoord4fv(%s);\n", gl_printVec(v, 4));
- GL_CALL(glTexCoord4fv, (const GLfloat *), (v));
- }
-
- void
- glTexEnvfv(GLenum target, GLenum pname, const GLfloat *param)
- {
- gl_header();
- gl_defVec(param, 4);
- printf("glTexEnvfv(%s, %s, %s);\n", gl_enum(target),
- gl_enum(pname), gl_printVec(param, 4));
- GL_CALL(glTexEnvfv, (GLenum,GLenum,const GLfloat *),\
- (target, pname, param));
- }
-
- void
- glTexEnvi(GLenum target, GLenum pname, GLint param)
- {
-
- gl_header();
- printf("glTexEnvi(%s, %s, %s);\n", gl_enum(target), gl_enum(pname),
- gl_enum(param));
- GL_CALL(glTexEnvi, (GLenum,GLenum,GLint), (target,pname,param));
- }
-
- void
- glTexGenf(GLenum coord, GLenum pname, GLfloat param)
- {
- gl_header();
- printf("glTexGenf(%s, %s, %g);\n", gl_enum(coord), gl_enum(pname), param);
- GL_CALL(glTexGenf, (GLenum,GLenum,GLfloat), (coord,pname,param));
- }
-
- void
- glTexGeni(GLenum coord, GLenum pname, GLint param)
- {
- gl_header();
- printf("glTexGeni(%s, %s, %d);\n", gl_enum(coord), gl_enum(pname), param);
- GL_CALL(glTexGeni, (GLenum,GLenum,GLint), (coord,pname,param));
- }
-
- void
- glTexGenfv(GLenum coord, GLenum pname, const GLfloat *params)
- {
- gl_header();
- gl_defVec(params, 4);
- printf("glTexGenfv(%s, %s, %s);\n", gl_enum(coord),
- gl_enum(pname), gl_printVec(params, 4));
- GL_CALL(glTexGenfv, (GLenum,GLenum,const GLfloat *), \
- (coord,pname,params));
- }
-
- void
- glTexParameteri(GLenum target, GLenum pname, GLint param)
- {
- gl_header();
- printf("glTexParameteri(%s, %s, %s);\n", gl_enum(target),
- gl_enum(pname),
- gl_enum(param));
- GL_CALL(glTexParameteri, (GLenum,GLenum,GLint), \
- (target,pname,param));
- }
-
- void
- glTranslatef(GLfloat x, GLfloat y, GLfloat z)
- {
- gl_header();
- printf("glTranslatef(%g, %g, %g);\n", x, y, z);
- GL_CALL(glTranslatef, (GLfloat,GLfloat,GLfloat), (x,y,z));
- }
-
- void
- glVertex2f(GLfloat x, GLfloat y)
- {
- gl_header();
- printf("glVertex2f(%g, %g);\n", x, y);
- GL_CALL(glVertex2f, (GLfloat,GLfloat), (x,y));
- }
-
- void
- glVertex2fv(const GLfloat *v)
- {
- #ifdef VEC_ROUTINES
- gl_header();
- gl_defVec(v, 2);
- printf("glVertex2fv(%s);\n", gl_printVec(v, 2));
- GL_CALL(glVertex2fv, (const GLfloat *), (v));
- #else
- glVertex2f(v[0], v[1]);
- #endif
- }
-
- void
- glVertex3f(GLfloat x, GLfloat y, GLfloat z)
- {
- gl_header();
- printf("glVertex3f(%g, %g, %g);\n", x, y, z);
- GL_CALL(glVertex3f, (GLfloat,GLfloat,GLfloat), (x,y,z));
- }
-
- void
- glVertex3fv(const GLfloat *v)
- {
- #ifdef VEC_ROUTINES
- gl_header();
- gl_defVec(v, 3);
- printf("glVertex3fv(%s);\n", gl_printVec(v, 3));
- GL_CALL(glVertex2fv, (const GLfloat *), (v));
- #else
- glVertex3f(v[0], v[1], v[2]);
- #endif
- }
-
- void
- glVertex4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
- {
- gl_header();
- printf("glVertex4f(%g, %g, %g, %g);\n", x, y, z, w);
- GL_CALL(glVertex4f, (GLfloat,GLfloat,GLfloat,GLfloat), (x,y,z,w));
- }
-
- void
- glVertex4fv(const GLfloat *v)
- {
- #ifdef VEC_ROUTINES
- gl_header();
- gl_defVec(v, 4);
- printf("glVertex4fv(%s);\n", gl_printVec(v, 4));
- GL_CALL(glVertex2fv, (const GLfloat *), (v));
- #else
- glVertex4f(v[0], v[1], v[2], v[3]);
- #endif
- }
-
- void
- glViewport(GLint x, GLint y, GLsizei width, GLsizei height)
- {
- gl_header();
- printf("glViewport(%d, %d, %d, %d);\n", x, y, width, height);
- GL_CALL(glViewport, (GLint,GLint,GLsizei,GLsizei),\
- (x,y,width,height));
- }
-
- /******************************************************************/
-
- #define GLU_GETSYM(returnType,name,argTypes) \
- static returnType (*fn) argTypes = NULL; \
- if (fn == NULL) \
- fn = (returnType (*) argTypes )lookup_sym(QUOTE(name),glu,&glu_dso )
- #define GLU_CALL(name, argTypes, argVals) \
- { GLU_GETSYM(void,name,argTypes); \
- ++recursing; (*fn) argVals ; --recursing; }
- #define GLU_RCALL(returnType, name, argTypes, argVals) \
- { GLU_GETSYM(returnType, name, argTypes); \
- ++recursing; result = (*fn) argVals ; --recursing; }
-
- void
- gluBeginPolygon(GLUtriangulatorObj *tobj)
- {
- printf("gluBeginPolygon(%#x);\n", tobj);
- GLU_CALL(gluBeginPolygon, (GLUtriangulatorObj *),(tobj));
- }
-
- void
- gluBeginSurface(GLUnurbsObj *nobj)
- {
- gl_header();
- printf("gluBeginSurface(%#x);\n", nobj);
- GLU_CALL(gluBeginSurface, (GLUnurbsObj *),(nobj));
- }
-
- void
- gluBeginTrim(GLUnurbsObj *nobj)
- {
- gl_header();
- printf("gluBeginTrim(%#x);\n", nobj);
- GLU_CALL(gluBeginTrim, (GLUnurbsObj *),(nobj));
- }
-
- int
- gluBuild2DMipmaps(GLenum target, GLint components,
- GLint width, GLint height,
- GLenum format, GLenum type, const void *data)
- {
- int result;
-
- gl_header();
- if (!output_code) {
- printf("gluBuild2DMipmaps(%s, %d, %d, %d, %s, %s, %#x);\n",
- gl_enum(target), components, width, height,
- gl_enum(format), gl_enum(type), data);
- }
- else {
- #ifndef SHORT
- int i;
- printf("{\n");
- gl_continue();
- printf("unsigned char b[%d];", width*height*components);
- for (i = 0; i < width*height*components; i++) {
- printf("b[%d]=%#x;", i, ((unsigned char *)data)[i]);
- }
- printf("\n");
- gl_continue();
- #endif
- printf("gluBuild2DMipmaps(%s, %d, %d, %d, %s, %s, ....);\n",
- gl_enum(target), components, width, height,
- gl_enum(format), gl_enum(type));
- #ifndef SHORT
- printf("}\n");
- #endif
- }
- GLU_RCALL(int,gluBuild2DMipmaps, \
- (GLenum, GLint,GLint,GLint,GLenum,GLenum,const void *),\
- (target, components, width, height, format, type,data));
- printf("/* gluBuild2DMipMaps returned %d */\n", result);
- return result;
- }
-
- void
- gluDeleteNurbsRenderer(GLUnurbsObj *nobj)
- {
- gl_header();
- printf("gluDeleteNurbsRenderer(%#x);\n", nobj);
- GLU_CALL(gluDeleteNurbsRenderer, (GLUnurbsObj *),(nobj));
- }
-
- void
- gluDeleteTess(GLUtriangulatorObj *tobj)
- {
- gl_header();
- printf("gluDeleteTess(%#x);\n", tobj);
- GLU_CALL(gluDeleteTess, (GLUtriangulatorObj *),(tobj));
- }
-
- void
- gluEndPolygon(GLUtriangulatorObj *tobj)
- {
- gl_header();
- printf("gluEndPolygon(%#x);\n", tobj);
- GLU_CALL(gluEndPolygon, (GLUtriangulatorObj *),(tobj));
- }
-
- void
- gluEndSurface(GLUnurbsObj *nobj)
- {
- gl_header();
- printf("gluEndSurface(%#x);\n", nobj);
- GLU_CALL(gluEndSurface, (GLUnurbsObj *),(nobj));
- }
-
- void
- gluEndTrim(GLUnurbsObj *nobj)
- {
- gl_header();
- printf("gluEndTrim(%#x);\n", nobj);
- GLU_CALL(gluEndTrim, (GLUnurbsObj *),(nobj));
- }
-
- const GLubyte *
- gluErrorString(GLenum code)
- {
- const GLubyte *result;
-
- gl_header();
- printf("gluErrorString(%d);\n", code);
- GLU_RCALL(const GLubyte *,gluErrorString, (GLenum ),(code));
- printf("/* gluErrorString returned %s */\n", result);
- return result;
- }
-
- GLUnurbsObj *
- gluNewNurbsRenderer(void)
- {
- GLUnurbsObj *result;
-
- gl_header();
- printf("gluNewNurbsRenderer();\n");
- GLU_RCALL(GLUnurbsObj *,gluNewNurbsRenderer, (),());
- printf("/* gluNewNurbsRenderer returned 0x%x */\n", result);
- return result;
- }
-
- GLUtriangulatorObj *
- gluNewTess(void)
- {
- GLUtriangulatorObj *result;
-
- gl_header();
- printf("gluNewTess();\n");
- GLU_RCALL(GLUtriangulatorObj*,gluNewTess, (),());
- printf("/* gluNewTess returned 0x%x */\n", result);
- return result;
- }
-
- void
- gluNextContour(GLUtriangulatorObj *tobj, GLenum type)
- {
- gl_header();
- printf("gluNextContour(%#x, %s);\n", tobj, gl_enum(type));
- GLU_CALL(gluNextContour, (GLUtriangulatorObj *,GLenum ),\
- (tobj,type));
- }
-
- void
- gluNurbsCurve(GLUnurbsObj *nobj, GLint nknots, GLfloat *knot, GLint
- stride, GLfloat *ctlarray, GLint order, GLenum type)
- {
- gl_header();
- printf("gluNurbsCurve(%#x, %d, ..., %d, ..., %d, %s);\n",
- nobj, nknots, stride, order, gl_enum(type));
- GLU_CALL(gluNurbsCurve, \
- (GLUnurbsObj *, GLint, GLfloat *, GLint, GLfloat *, GLint, GLenum ),\
- (nobj,nknots,knot,stride,ctlarray,order,type));
- }
-
- void
- gluNurbsProperty(GLUnurbsObj *nobj, GLenum property, GLfloat value)
- {
- gl_header();
- printf("gluNurbsProperty(%#x, %s, %g);\n", nobj, gl_enum(property), value);
- GLU_CALL(gluNurbsProperty, (GLUnurbsObj *, GLenum, GLfloat ),\
- (nobj,property,value));
- }
-
- void
- gluNurbsSurface(GLUnurbsObj *nobj,
- GLint sknot_count, GLfloat *sknot,
- GLint tknot_count, GLfloat *tknot,
- GLint s_stride, GLint t_stride,
- GLfloat *ctlarray, GLint sorder, GLint torder, GLenum type)
- {
-
- gl_header();
- printf("gluNurbsSurface(%#x, %d, ..., %d, ..., %d, %d, ..., %d, %d, %s);\n",
- nobj, sknot_count, tknot_count, s_stride, t_stride,
- sorder, torder, gl_enum(type));
- GLU_CALL(gluNurbsSurface,\
- (GLUnurbsObj*,GLint,GLfloat*,GLint,GLfloat*,GLint,GLint,GLfloat*,GLint,GLint,GLenum),\
- (nobj,sknot_count,sknot,tknot_count,tknot,s_stride,t_stride,ctlarray,sorder,torder,type));
- }
-
- void
- gluPwlCurve(GLUnurbsObj *nobj, GLint count, GLfloat *array, GLint
- stride, GLenum type)
- {
- gl_header();
- printf("gluPwlCurve(%#x, %d, ..., %d, %s);\n",
- nobj, count, stride, gl_enum(type));
- GLU_CALL(gluPwlCurve, (GLUnurbsObj *, GLint, GLfloat *, GLint,GLenum),\
- (nobj,count,array,stride,type));
- }
-
- void
- gluTessCallback(GLUtriangulatorObj *tobj, GLenum which, void (*func)())
- {
- gl_header();
- printf("gluTessCallback(%#x, %s, %#x);\n", tobj, gl_enum(which), func);
- GLU_CALL(gluTessCallback,(GLUtriangulatorObj *, GLenum, void (*)()),\
- (tobj,which,func));
- }
-
- void
- gluTessVertex(GLUtriangulatorObj *tobj, GLdouble v[3], void *data)
- {
- gl_header();
- gl_defVecd(v, 3);
- printf("gluTessVertex(%#x, %s, %#x);\n", tobj, gl_printVecd(v, 3), data);
- GLU_CALL(gluTessVertex, (GLUtriangulatorObj *, GLdouble v[3], void *),\
- (tobj,v,data));
- }
-
- /******************************************************************/
-
- #define GLX_CALL(name, argTypes, argVals) GL_CALL(name, argTypes, argVals)
- #define GLX_RCALL(returnType, name, argTypes, argVals) \
- GL_RCALL(returnType, name, argTypes, argVals)
-
- static void
- _spitout_Attributes(int *attr)
- {
- int counter = 0;
- while (attr[counter] != None) {
- switch(attr[counter++]) {
- case GLX_USE_GL:
- printf("GLX_USE_GL, ");
- break;
- case GLX_BUFFER_SIZE:
- printf("GLX_BUFFER_SIZE, %d, ", attr[counter++]);
- break;
- case GLX_LEVEL:
- printf("GLX_LEVEL, %d, ", attr[counter++]);
- break;
- case GLX_RGBA:
- printf("GLX_RGBA, ");
- break;
- case GLX_DOUBLEBUFFER:
- printf("GLX_DOUBLEBUFFER, ");
- break;
- case GLX_STEREO:
- printf("GLX_STEREO, ");
- break;
- case GLX_AUX_BUFFERS:
- printf("GLX_AUX_BUFFERS, %d, ", attr[counter++]);
- break;
- case GLX_RED_SIZE:
- printf("GLX_RED_SIZE, %d, ", attr[counter++]);
- break;
- case GLX_GREEN_SIZE:
- printf("GLX_GREEN_SIZE, %d, ", attr[counter++]);
- break;
- case GLX_BLUE_SIZE:
- printf("GLX_BLUE_SIZE, %d, ", attr[counter++]);
- break;
- case GLX_ALPHA_SIZE:
- printf("GLX_ALPHA_SIZE, %d, ", attr[counter++]);
- break;
- case GLX_DEPTH_SIZE:
- printf("GLX_DEPTH_SIZE, %d, ", attr[counter++]);
- break;
- case GLX_STENCIL_SIZE:
- printf("GLX_STENCIL_SIZE, %d, ", attr[counter++]);
- break;
- case GLX_ACCUM_RED_SIZE:
- printf("GLX_ACCUM_RED_SIZE, %d, ", attr[counter++]);
- break;
- case GLX_ACCUM_GREEN_SIZE:
- printf("GLX_ACCUM_GREEN_SIZE, %d, ", attr[counter++]);
- break;
- case GLX_ACCUM_BLUE_SIZE:
- printf("GLX_ACCUM_BLUE_SIZE, %d, ", attr[counter++]);
- break;
- case GLX_ACCUM_ALPHA_SIZE:
- printf("GLX_ACCUM_ALPHA_SIZE, %d, ", attr[counter++]);
- break;
- default:
- fprintf(stderr, "ACK! bad param in attribute list\n");
- break;
- }
- }
- printf("None\n");
- }
-
- XVisualInfo *
- glXChooseVisual(Display *dpy, int screen, int *i)
- {
- XVisualInfo *result;
-
- gl_header();
- printf("glXChooseVisual(0x%x, 0x%x,...);\n");
- _spitout_Attributes(i);
-
- GLX_RCALL(XVisualInfo*,glXChooseVisual, (Display*,int,int*),(dpy, screen, i));
- printf("/* glXChooseVisual returned 0x%x */\n", result);
- return result;
- }
-
- GLXContext
- glXCreateContext(Display *dpy, XVisualInfo *i, GLXContext c, Bool b)
- {
- GLXContext result;
-
- gl_header();
- printf("glXCreateContext(0x%x,0x%x,0x%x,%d);\n",
- dpy, i, c, b);
- GLX_RCALL(GLXContext,glXCreateContext, \
- (Display*,XVisualInfo*,GLXContext,Bool),(dpy,i,c,b));
- printf("/* glXCreateContext returned 0x%x */\n", result);
- return result;
- }
-
- GLXPixmap
- glXCreateGLXPixmap(Display *dpy, XVisualInfo *vis, Pixmap pixmap)
- {
- GLXPixmap result;
- gl_header();
- printf("glXCreateGLXPixmap(0x%x,0x%x,0x%x);\n",
- dpy,vis,pixmap);
- GLX_RCALL(GLXPixmap,glXCreateGLXPixmap, (Display*,XVisualInfo*,Pixmap),(dpy,vis,pixmap));
- printf("/* glXCreateGLXPixmap returned 0x%x */\n", result);
- return result;
- }
-
- void
- glXDestroyContext(Display *dpy, GLXContext ctx)
- {
- gl_header();
- printf("glXDestroyContext(0x%x,0x%x);\n", dpy, ctx);
- GLX_CALL(glXDestroyContext, (Display *, GLXContext),(dpy,ctx));
- }
-
- void
- glXDestroyGLXPixmap(Display *dpy, GLXPixmap pix)
- {
- gl_header();
- printf("glXDestroyGLXPixmap(0x%x,0x%x);\n", dpy, pix);
- GLX_CALL(glXDestroyGLXPixmap, (Display *, GLXPixmap),(dpy,pix));
- }
-
- int
- glXGetConfig(Display *dpy, XVisualInfo *vis, int attrib, int *value)
- {
- int result;
-
- gl_header();
- printf("glXGetConfig(0x%x, 0x%x, %d, 0x%x);\n",
- dpy,vis,attrib,value,result);
- GLX_RCALL(int, glXGetConfig, (Display*,XVisualInfo*,int,int*),(dpy,vis,attrib,value));
- printf("/* glXGetConfig returned %d */\n", result);
- return result;
- }
-
- Bool
- glXMakeCurrent(Display *dpy, GLXDrawable d, GLXContext c)
- {
- Bool result;
-
- gl_header();
- printf("glXMakeCurrent(0x%x,0x%x,0x%x);\n",
- dpy,d,c);
- GLX_RCALL(Bool,glXMakeCurrent, (Display*,GLXDrawable,GLXContext),(dpy,d,c));
- printf("/* glXMakeCurrent returned %d */\n", result);
- return result;
- }
-
- void
- glXSwapBuffers(Display *dpy, GLXDrawable drawable)
- {
- gl_header();
- printf("glXSwapBuffers(0x%x,0x%x);\n", dpy, drawable);
- GLX_CALL(glXSwapBuffers, (Display*,GLXDrawable),(dpy,drawable));
- }
-
-
-